<template>





        <table class="table table-bordered">
            <thead>
            

                <tr>

                    <th>编号</th>
                    <th>姓名</th>
                    <th>状态</th>
                    <th>图片</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody v-for="item in aa">
                    
                <tr>

                              <th>{{ item.shop_Id }}</th>
                            <th>{{ item.shop_Name }}</th>
                            <th>{{ item.shop_Satic?"营业":"暂停营业" }}</th>
                            <th>{{ item.shop_Img }}</th>
                            <th>
                                    <button @click="Isdel(item.shop_Id)" class="btn btn-success">删除</button>
                                    <button @click="Xg(item.shop_Id)" class="btn btn-success">修改</button>

                            </th>
                        </tr>



            </tbody>



        </table>











</template>


<script setup lang="ts">
import axios from 'axios';
import { onMounted } from 'vue';

import { ref } from 'vue';


onMounted(()=>{

    Show();
})


const  aa = ref([{

    "shop_Id": 0,
    "shop_Name": "string",
    "shop_Img": "string",
    "shop_Satic": true,
    "shop_IsDel": true


}])



const Show=()=>{

        axios.get('https://localhost:7260/api/User/ShowShop').then(res=>{

            aa.value=res.data
        })


}



const  Xg=(id2:number)=>{


if(!confirm('确认修改吗'))
{
    return ;
}

        axios.put('https://localhost:7260/api/User/XgShow?id='+id2).then(res=>{

            if(res.data>0)
        {
            alert('修改成功')
        }
        else
        {
            alert('修改失败')
        }
        })
}



const    Isdel=(id1:number)=>{


if(!confirm('确认删除吗'))
{
return ;
}

    axios.delete('https://localhost:7260/api/User/IsDel',{params:{

        id:id1,

    }}).then(res=>{

        if(res.data>0)
    {
        alert('删除成功')
    }
    else
    {
        alert('删除失败')
    }
    })
}

</script>